import 'package:aweb5/generated/json/common_result_entity_helper.dart';
import 'package:aweb5/generated/json/follow_list_entity_helper.dart';
import 'package:aweb5/pages/choose_mission.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aweb5/Para.dart';
import 'package:aweb5/custom/dash_painter.dart';
import 'package:aweb5/custom/dashed_rect.dart';
import 'package:aweb5/style.dart';
import 'package:aweb5/custom/DottedLineWidget.dart';
import 'package:load/load.dart';
import 'package:aweb5/config/Config.dart';
import 'package:aweb5/Constants.dart';
import 'package:aweb5/util/toast_util.dart';
//import 'package:aweb5/bean/aplus/jjhw_product_list_entity.dart';
import 'package:aweb5/util/HttpClient.dart';
import 'package:aweb5/bean/aplus/common_result_entity.dart';
import 'package:aweb5/util/DialogUtil.dart';
import 'package:aweb5/widgetlib/menu_widget.dart';
import 'package:aweb5/util/NaviUtil.dart';
import 'package:aweb5/bean/aplus/follow_list_entity.dart';
import 'package:aweb5/bean/aplus/group_plan_list_entity.dart';
import 'package:aweb5/pages/view_somebody_and_officialassist_plan.dart';

///公用页面
class TodayPlanHomePage extends StatefulWidget {
  bool hasFollowOfficialAssist;
  List<DropdownMenuItem<String>> sortItems = [];
  String _selectedSort = "";
  String hasFollowName;
  String weekday;
  List<GroupPlanListDataGroup> groupList;
  String url;
  Function call;
  TodayPlanHomePage(this.hasFollowOfficialAssist, this.sortItems,
      this._selectedSort, this.hasFollowName,
      {this.weekday, this.groupList, this.url,this.call});

  @override
  _TodayPlanHomePageState createState() => _TodayPlanHomePageState();
}

class _TodayPlanHomePageState extends State<TodayPlanHomePage> {
  GlobalKey globalKey = GlobalKey();
  List<FollowListData> data = List();
  BuildContext context;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      requetFollowList();

      print(
          "${(globalKey.currentContext.findRenderObject() as RenderBox).size.height}");
    });
  }

//  bool hasplan = false;
  @override
  Widget build(BuildContext context) {
    this.context = context;
    return Scaffold(
      body: SafeArea(
          child: Column(
        children: <Widget>[todayplan(), stack()],
      )),
    );
  }

  Widget todayplan() {
    return Container(
        key: globalKey,
        width: Para.width,
        color: Colors.white,
        padding: EdgeInsets.symmetric(
            horizontal: ScreenUtil().setWidth(16),
            vertical: ScreenUtil().setHeight(11)),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  "今日计划",
                  style: TextStyle(
                      color: Color(0xff101010),
                      fontWeight: FontWeight.bold,
                      fontSize: ScreenUtil().setSp(20)),
                ),
                Text(
                  "最多显示7天内的计划  ${widget.weekday}",
                  style: TextStyle(
                    color: Color(0xff101010),
                    fontSize: ScreenUtil().setSp(14),
                  ),
                ),
              ],
            ),
            GestureDetector(
              child: Container(
                width: ScreenUtil().setWidth(116),
                height: ScreenUtil().setHeight(40),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(3),
                    border: Border.all(color: Color(0xffF94F68))),
                child: Text(
                  "添加任务",
                  style: TextStyle(
                      color: Color(0xffF94F68),
                      fontSize: ScreenUtil().setSp(16)),
                ),
              ),
              onTap: () {
                NaviUtil.push(
                    context,
                    ChooseMission(widget.sortItems, widget._selectedSort,
                        widget.groupList));
              },
            )
          ],
        ));
  }

  Widget stack() {
    return Expanded(
      child: Stack(
        children: <Widget>[
          contentOfStack(),
          Positioned(
            child: Container(
//              color: Colors.blue,
              width: ScreenUtil().setWidth(20),
              height: ScreenUtil().setHeight(20),
              child: Image.asset("assets/assist/biaoqian.png"),
            ),
            left: ScreenUtil().setWidth(19),
            top: ScreenUtil().setHeight(187),
          )
        ],
      ),
    );
  }

  Widget contentOfStack() {
    return Column(
      children: <Widget>[
        planwidget(),
        Container(
          height: ScreenUtil().setHeight(81),
          width: ScreenUtil().setWidth(414),
          padding: EdgeInsets.only(
              left: ScreenUtil().setWidth(20),
              right: ScreenUtil().setWidth(20),
              top: ScreenUtil().setHeight(37)),
          child: Text(
            "还有15份计划可以跟随",
            style: TextStyle(
                color: Color(0xff101010),
                fontSize: ScreenUtil().setSp(20),
                fontWeight: FontWeight.bold),
          ),
        ),
        Container(
          width: ScreenUtil().setWidth(372),
          child: DashedRect(
            color: Color(0xffbbbbbb),
          ),
        ),
        Expanded(child: listView())
      ],
    );
  }

  Widget planwidget() {
    if (!widget.hasFollowOfficialAssist) {
      return Container(
        height: ScreenUtil().setHeight(191),
        width: ScreenUtil().setWidth(414),
        color: Color(0xfff5f5f5),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[

//                CircleAvatar(
//                  backgroundColor: Colors.transparent,
//                  radius: ScreenUtil().setWidth(26),
//                  backgroundImage: AssetImage("assets/assist/cartoon.png"),
//                ),

                Image.asset("assets/assist/cartoon.png",width: ScreenUtil().setWidth(50),height: ScreenUtil().setHeight(50),),

                SizedBox(
                  width: ScreenUtil().setWidth(11),
                ),
                Text(
                  "暂无任务计划",
                  style: TextStyle(
                      color: Color(0xff101010),
                      fontSize: ScreenUtil().setSp(18)),
                )
              ],
            ),
            SizedBox(
              height: ScreenUtil().setHeight(21),
            ),
            GestureDetector(
              child: Container(
                width: ScreenUtil().setWidth(133),
                height: ScreenUtil().setHeight(40),
                decoration: redButtonStyle,
                alignment: Alignment.center,
                child: Text(
                  "跟随官方助理",
                  style: TextStyle(
                      color: Colors.white, fontSize: ScreenUtil().setSp(16)),
                ),
              )
              ,
              onTap: (){

//                NaviUtil.push(
//                    context,
//                    ViewSomebodyAndOfficialAssistPlan(
//                      id: "",
//                      url: "",
//                      name: "A+官方助理",
//                      desc: "",
//                      hasfollowName: widget.hasFollowName,
//                      hasfollowUrl: widget.url,
//                      sortItems: widget.sortItems,
//                      selectedSort: widget._selectedSort,
//                      official: true,
//                    ));


                if (widget.hasFollowName.isNotEmpty) {
//                  _showChangeFollowDialog(
//                      data[ind].name, data[ind].headimgurl, data[ind].desc,1);
                  _showChangeFollowDialog(
                      toname: "A+官方助理",tourl: "assets/assist/aplus.png",desc: "",official: 1);
                } else {
                  _showFollowDialog(
                      toname: "A+官方助理",tourl: "assets/assist/aplus.png",desc: "",official: 1);
                }


//              requetFollow(1);
              },
            )

          ],
        ),
      );
    } else {
      return Container(
        height: ScreenUtil().setHeight(191),
        width: ScreenUtil().setWidth(414),
        color: Color(0xfff5f5f5),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                CircleAvatar(
                  backgroundColor: Colors.transparent,
                  radius: ScreenUtil().setWidth(26),
                  backgroundImage: AssetImage("assets/assist/cartoon.png"),
                ),
                SizedBox(
                  width: ScreenUtil().setWidth(11),
                ),
                Text(
                  "暂无任务计划",
                  style: TextStyle(
                      color: Color(0xff101010),
                      fontSize: ScreenUtil().setSp(18)),
                )
              ],
            ),
          ],
        ),
      );
    }
  }
//列表
  Widget listView() {
    return ListView.builder(
      itemBuilder: (con, ind) {
        return item(ind);
      },
      itemCount: data.length,
      shrinkWrap: true,
    );
  }

  Widget item(int ind) {
    return GestureDetector(
      child: Container(
        width: ScreenUtil().setWidth(414),
        height: ScreenUtil().setHeight(95),
        padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
        child: Row(
          children: <Widget>[
            Container(
              height: ScreenUtil().setHeight(46),
              width: ScreenUtil().setHeight(43),
              child: Stack(
                children: <Widget>[
                  CircleAvatar(
                    backgroundColor: Colors.white,
                    radius: ScreenUtil().setWidth(21.5),
                    backgroundImage: NetworkImage("${data[ind].headimgurl}"),
                  ),
                  LayoutBuilder(builder: (con, box) {
                    print("box${box.maxWidth}");
                    return Text("");
                  }),
//                  Positioned(
//                      child: Container(
//                    alignment: Alignment.bottomCenter,
//                    child: Container(
////                    alignment: Alignment.bottomCenter,
//                      child: Text(
//                        "呵呵",
//                        style: TextStyle(
//                            color: Colors.white,
//                            fontSize: ScreenUtil().setSp(10)),
//                      ),
//                      decoration: BoxDecoration(
//                          color: Color(0xffF94F68),
//                          borderRadius: BorderRadius.circular(2)),
//                      padding: EdgeInsets.all(ScreenUtil().setWidth(1)),
//                    ),
//                  ))
                ],
              ),
            ),
            SizedBox(
              width: ScreenUtil().setWidth(20),
            ),
            Expanded(
                child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  "${data[ind].name}",
                  style: TextStyle(
                      color: textColor10, fontSize: ScreenUtil().setSp(14)),
                ),
                Expanded(child: Text("")),
                Container(
                  height: ScreenUtil().setHeight(15),
//                    alignment: Alignment.bottomCenter,
                  child: Text(
                    "${data[ind].desc}",
                    style: TextStyle(
                        color: Colors.white, fontSize: ScreenUtil().setSp(10)),
                  ),
                  decoration: BoxDecoration(
                      color: Color(0xffF94F68),
                      borderRadius: BorderRadius.circular(2)),
                  padding: EdgeInsets.all(ScreenUtil().setWidth(1)),
                )
              ],
            )),
            Expanded(child: Text("")),
            GestureDetector(
              child: Container(
                width: ScreenUtil().setWidth(71),
                height: ScreenUtil().setHeight(40),
                child: Text(
                  "跟随",
                  style: TextStyle(
                      color: Colors.white, fontSize: ScreenUtil().setSp(18)),
                ),
                decoration: redButtonStyle,
                alignment: Alignment.center,
              ),
              onTap: () {
                followid = data[ind].memberId.toString();

                if (widget.hasFollowName.isNotEmpty) {
                  _showChangeFollowDialog(
                      toname:data[ind].name, tourl:data[ind].headimgurl, desc:data[ind].desc,official: 0);
                } else {
                  _showFollowDialog(
                      toname:data[ind].name, tourl:data[ind].headimgurl, desc:data[ind].desc,official: 0);
                }
//                  _showChooseGroupDialog();
              },
            )
          ],
        ),
      ),
      onTap: () {
//        NaviUtil.push(
//            context,
//            ViewSomebodyAndOfficialAssistPlan(
//              id: data[ind].memberId.toString(),
//              url: data[ind].headimgurl,
//              name: data[ind].name,
//              desc: data[ind].desc,
//              hasfollowName: widget.hasFollowName,
//              hasfollowUrl: widget.url,
//              sortItems: widget.sortItems,
//              selectedSort: widget._selectedSort,
//              official: false,
//            ));
      },
    );
  }

  void dialogCall(String groupId) {
    this.selectGroup = groupId;
  }

  _showFollowDialog({String toname, String tourl, String desc,int official}) {
    DialogUtil.showdialog1(
        this.context,
        Container(
          width: ScreenUtil().setWidth(323),
          height: ScreenUtil().setHeight(233),
          decoration: BoxDecoration(
              color: Colors.white, borderRadius: BorderRadius.circular(4)),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(
                height: ScreenUtil().setHeight(24),
              ),
              Text(
                "您将永久跟随TA的每日运营计划",
                style: TextStyle(
                    color: Color(0xff000000),
                    fontSize: ScreenUtil().setSp(16),
                    fontWeight: FontWeight.bold),
              ),
              SizedBox(
                height: ScreenUtil().setHeight(24),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[

                  CircleAvatar(
                    radius: ScreenUtil().setWidth(21.5),
                    backgroundImage: official==1?AssetImage("assets/assist/aplus.png"):NetworkImage("${tourl}"),
                  ),
                  SizedBox(
                    width: ScreenUtil().setWidth(12),
                  ),
                  Column(
                    children: <Widget>[
                      Text(
                        "${toname}",
                        style: TextStyle(
                            color: Color(0xff000000),
                            fontSize: ScreenUtil().setSp(18),
                            fontWeight: FontWeight.bold),
                      ),
//                      Container(
//                        alignment: Alignment.center,
//                        width: ScreenUtil().setWidth(56),
//                        height: ScreenUtil().setHeight(14),
//                        decoration: redButtonStyle,
//                        child: Text(
//                          "${desc}",
//                          style: TextStyle(
//                              color: Colors.white,
//                              fontSize: ScreenUtil().setSp(10)),
//                        ),
//                      )
                    ],
                  )
                ],
              ),
              SizedBox(
                height: ScreenUtil().setHeight(33),
              ),
              Row(
                children: <Widget>[
                  SizedBox(
                    width: ScreenUtil().setWidth(33),
                  ),
                  GestureDetector(
                    child: Container(
                      width: ScreenUtil().setWidth(119),
                      height: ScreenUtil().setHeight(40),
                      decoration: redButtonStyleWithBorder,
                      alignment: Alignment.center,
                      child: Text(
                        "取消",
                        style: TextStyle(
                            color: Color(0xffF94F68),
                            fontSize: ScreenUtil().setSp(16)),
                      ),
                    ),
                    onTap: () {
                      NaviUtil.pop(context);
                    },
                  ),
                  SizedBox(
                    width: ScreenUtil().setWidth(15),
                  ),
                  GestureDetector(
                    child: Container(
                      width: ScreenUtil().setWidth(119),
                      height: ScreenUtil().setHeight(40),
                      decoration: redButtonStyle,
                      alignment: Alignment.center,
                      child: Text(
                        "确定",
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: ScreenUtil().setSp(16)),
                      ),
                    ),
                    onTap: () {
                      NaviUtil.pop(context);
                      requetFollow(official);
//                      _showChooseGroupDialog();
                    },
                  ),
                ],
              )
            ],
          ),
        ),
        ScreenUtil().setHeight(233));
  }

//  void _showChooseGroupDialog() {
//    DialogUtil.showdialog1(
//        context,
//        Container(
//          padding: EdgeInsets.symmetric(
//              horizontal: ScreenUtil().setWidth(30),
//              vertical: ScreenUtil().setHeight(30)),
//          width: ScreenUtil().setWidth(329),
//          height: ScreenUtil().setHeight(215),
//          child: Column(
//            crossAxisAlignment: CrossAxisAlignment.start,
//            children: <Widget>[
//              Text(
//                "选择群",
//                style: TextStyle(
//                    color: Color(0xff101010),
//                    fontSize: ScreenUtil().setSp(16),
//                    fontWeight: FontWeight.bold),
//              ),
//              Expanded(child: Text("")),
//              Container(
//                padding: EdgeInsets.only(left: ScreenUtil().setWidth(5)),
//                alignment: Alignment.centerLeft,
//                width: ScreenUtil().setWidth(261),
//                height: ScreenUtil().setHeight(40),
//                decoration: BoxDecoration(
//                    borderRadius:
//                        BorderRadius.circular(ScreenUtil().setWidth(4)),
//                    border: Border.all(color: Color(0xffDCDFE6))),
//                child: MenuWidget(
//                  widget.sortItems,
//                  widget._selectedSort,
//                  call: dialogCall,
//                ),
//              ),
//              Expanded(child: Text("")),
//              Row(
//                mainAxisAlignment: MainAxisAlignment.spaceBetween,
//                children: <Widget>[
//                  GestureDetector(
//                    child: Container(
//                      alignment: Alignment.center,
//                      width: ScreenUtil().setWidth(119),
//                      height: ScreenUtil().setHeight(40),
//                      child: Text(
//                        "取消",
//                        style: TextStyle(color: Color(0xffF94F68)),
//                      ),
//                      decoration: redButtonStyleWithBorder,
//                    ),
//                    onTap: () {
////                        showdialog = false;
////                        setState(() {
////
////                        });
////                        Overlay.of(context).reassemble();
//                      NaviUtil.pop(context);
//                    },
//                  ),
//                  GestureDetector(
//                    child: Container(
//                      alignment: Alignment.center,
//                      width: ScreenUtil().setWidth(119),
//                      height: ScreenUtil().setHeight(40),
//                      child: Text(
//                        "确定",
//                        style: TextStyle(color: Colors.white),
//                      ),
//                      decoration: redButtonStyle,
//                    ),
//                    onTap: () {
//                      NaviUtil.pop(context);
//                      requetFollow(0);
//                    },
//                  )
//                ],
//              )
//            ],
//          ),
//          decoration: BoxDecoration(
//              color: Colors.white, borderRadius: BorderRadius.circular(3)),
//        ),
//        ScreenUtil().setHeight(215));
//  }

  _showChangeFollowDialog({String toname, String tourl, String desc,int official}) {
    DialogUtil.showdialog1(
        this.context,
        Container(
          width: ScreenUtil().setWidth(323),
          height: ScreenUtil().setHeight(362),
          decoration: BoxDecoration(
              color: Colors.white, borderRadius: BorderRadius.circular(4)),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              SizedBox(
                height: ScreenUtil().setHeight(24),
              ),
              Text(
                "您是否要更改您的跟随计划",
                style: TextStyle(
                    color: Color(0xff000000),
                    fontSize: ScreenUtil().setSp(16),
                    fontWeight: FontWeight.bold),
              ),
              SizedBox(
                height: ScreenUtil().setHeight(27),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  CircleAvatar(
                    radius: ScreenUtil().setWidth(21.5),
                    backgroundImage: NetworkImage("${widget.url}"),
                  ),
                  SizedBox(
                    width: ScreenUtil().setWidth(12),
                  ),
                  Column(
                    children: <Widget>[
                      Text(
                        "${widget.hasFollowName}",
                        style: TextStyle(
                            color: Color(0xff000000),
                            fontSize: ScreenUtil().setSp(18),
                            fontWeight: FontWeight.bold),
                      ),
//                      Container(
//                        alignment: Alignment.center,
//                        width: ScreenUtil().setWidth(56),
//                        height: ScreenUtil().setHeight(14),
////                        decoration: redButtonStyle,
//                        child: Text(
//                          " ",
//                          style: TextStyle(
//                              color: Colors.white,
//                              fontSize: ScreenUtil().setSp(10)),
//                        ),
//                      )
                    ],
                  )
                ],
              ),
              SizedBox(
                height: ScreenUtil().setHeight(15),
              ),
              Image.asset(
                "assets/assist/change.png",
                width: ScreenUtil().setWidth(44),
                height: ScreenUtil().setHeight(44),
              ),
              SizedBox(
                height: ScreenUtil().setHeight(15),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  CircleAvatar(
                    radius: ScreenUtil().setWidth(21.5),
                    backgroundImage: official==1?AssetImage("assets/assist/aplus.png"):NetworkImage("${tourl}"),
                  ),
                  SizedBox(
                    width: ScreenUtil().setWidth(12),
                  ),
                  Column(
                    children: <Widget>[
                      Text(
                        "${toname}",
                        style: TextStyle(
                            color: Color(0xff000000),
                            fontSize: ScreenUtil().setSp(18),
                            fontWeight: FontWeight.bold),
                      ),
//                      Container(
//                        alignment: Alignment.center,
//                        width: ScreenUtil().setWidth(56),
//                        height: ScreenUtil().setHeight(14),
//                        decoration: redButtonStyle,
//                        child: Text(
//                          "${desc}",
//                          style: TextStyle(
//                              color: Colors.white,
//                              fontSize: ScreenUtil().setSp(10)),
//                        ),
//                      )
                    ],
                  )
                ],
              ),
              SizedBox(
                height: ScreenUtil().setHeight(29),
              ),
              Row(
                children: <Widget>[
                  SizedBox(
                    width: ScreenUtil().setWidth(33),
                  ),
                  GestureDetector(
                    child: Container(
                      width: ScreenUtil().setWidth(119),
                      height: ScreenUtil().setHeight(40),
                      decoration: redButtonStyleWithBorder,
                      alignment: Alignment.center,
                      child: Text(
                        "取消",
                        style: TextStyle(
                            color: Color(0xffF94F68),
                            fontSize: ScreenUtil().setSp(16)),
                      ),
                    ),
                    onTap: () {
                      NaviUtil.pop(context);
                    },
                  ),
                  SizedBox(
                    width: ScreenUtil().setWidth(15),
                  ),
                  GestureDetector(
                    child: Container(
                      width: ScreenUtil().setWidth(119),
                      height: ScreenUtil().setHeight(40),
                      decoration: redButtonStyle,
                      alignment: Alignment.center,
                      child: Text(
                        "确定",
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: ScreenUtil().setSp(16)),
                      ),
                    ),
                    onTap: () {
                      NaviUtil.pop(context);
                      requetFollow(official);
//                      _showChooseGroupDialog();
                    },
                  ),
                ],
              )
            ],
          ),
        ),
        ScreenUtil().setHeight(362));
  }

  String selectGroup = "";
  String followid = "";
  void requetFollow(int official) async {

    DialogUtil.showloadingdialog(context);
    try {
      Map<String, dynamic> map = Map<String, dynamic>();

//      map["member_id"] = Constants.memberInfoEntity.data.memberId;
      map["member_id"] = Constants.memberInfoEntity.data.memberId;
      map["is_official"] = official;
      map["follow_id"] = followid;
      map["group_id"] = Constants.currentGroupId;
      map["is_forever"] = 1;

      Map<String, dynamic> map1 = await HttpClient.requestLogin(
          Config.requestApi + 'light/member/follow',
          data: map);

      CommonResultEntity loginEntity = new CommonResultEntity();

      loginEntity = commonResultEntityFromJson(loginEntity, map1);

      DialogUtil.pop(context);
      if (loginEntity.code == null || loginEntity.code != 200) {
//        Fluttertoast.showToast(msg: "null");
        Toast.show(msg: loginEntity.msg);
         return;
      }
      if (loginEntity.code == 200) {
        if(widget.call!=null){
          widget.call();
        }
        Toast.show(msg: "跟随成功");
//        NaviUtil.pop(this.context);
      }
    } catch (e) {
      print(e.toString());
      DialogUtil.pop(context);
    }
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();

  }

  void requetFollowList() async {

//    DialogUtil.showloadingdialog(context);
    try {
      Map<String, dynamic> map = Map<String, dynamic>();

      Map<String, dynamic> map1 = await HttpClient.requestLogin(
          Config.requestApi + 'light/member/recommend',
          data: map);

      FollowListEntity loginEntity = new FollowListEntity();

      loginEntity = followListEntityFromJson(loginEntity, map1);

//      DialogUtil.pop(context);
      if (loginEntity.code == null || loginEntity.code != 200) {
//        Fluttertoast.showToast(msg: "null");
        Toast.show(msg: loginEntity.msg);
         return;
      }
      if (loginEntity.code == 200) {
        this.data = loginEntity.data;
        setState(() {});
//        NaviUtil.pop(this.context);
      }
    } catch (e) {
      print(e.toString());
//      DialogUtil.pop(context);
    }
  }
}
